package subjectlist;

public class D如何找出数组中丢失的数 {

    private static class A异或运算{
        public static int getNum(int[]arr){
            if (arr == null || arr.length <= 0) {
                System.out.println("参数不合理");
                return -1;
            }
            int a=arr[0],b=1;
            int i;
            int len=arr.length;
            for (i = 0; i <len ; i++) {
                a=a^arr[i];
            }
            for (i = 2; i <=len+1 ; i++) {
                b=b^i;
            }
            return a^b;
        }
    }

}
